function meleeCallback(targetLoc)

	if (   (math.abs( targetLoc[1] - characterLoc[1] ) > 1)
		or (math.abs( targetLoc[2] - characterLoc[2] ) > 1) )  then
		addConsoleMessage("That is out of range of your " .. playerItems[usingItem].desc)
		return
	end


	local targetMob = getMobOnTile(targetLoc[1],targetLoc[2])
	local targetStr = "mid-air"

	if (targetMob ~= nil) then
		playerHitMob(playerItems[usingItem],targetMob)
	else
		addConsoleMessage("You take a swing at mid-air with your "..playerItems[usingItem].desc, "yellow")
	end
	
	gameTick()

end


function gunCallback(targetLoc)

	if (playerItems[usingItem]["ammo"] == 0 ) then
		addConsoleMessage("Your gun clicks, it's out of ammunition!", "yellow")
		gameTick()
		return
	end

	if (ComputeFOV(characterLoc, playerHeading.value, targetLoc, playerItems[usingItem].range, false) == false) then
		addConsoleMessage("That is out of your weapon's range!")
		return
	end

	-- Fire gun
	playerItems[usingItem]["ammo"] = playerItems[usingItem]["ammo"] - 1

	-- Check for target Mob
	local targetMob = getMobOnTile(targetLoc[1],targetLoc[2])

	if (targetMob ~= nil) then
		playerHitMob(playerItems[usingItem],targetMob)
	else
		addConsoleMessage("You fire your ".. playerItems[usingItem].desc .. " into the ground.", "yellow")
	end

	-- Gunshot alerts all mobs if no silencer
	local silencer = hasItem("silencer",true)
	if (silencer ~= nil) then
		addConsoleMessage("Your active silencer muffles the shot.","green")
		playerItems[silencer].shotsLeft = playerItems[silencer].shotsLeft - 1
	else
		alertAllMobs()
	end

	gameTick()
end

function lookCallback(targetLoc)

	local mob = getMobOnTile(targetLoc[1],targetLoc[2])

	if (mob ~= nil ) then
		addConsoleMessage("You see a " .. mob.desc ..". It's integrity is at " .. mob.health .. "%. It is " .. armourString[mob.armour]..".")
		addConsoleMessage("It's melee weapons look " .. weaponDanger[mob.meleeDamage] .. " and it's ranged weapons look " .. weaponDanger[mob.rangedDamage]..".")
		return
	end

	if (isItemOnGround(targetLoc[1],targetLoc[2]) == true ) then
		addConsoleMessage("You see something lying in the snow, although you can't make it out.")
		return
	end

	if (isObjectBlocking(targetLoc[1],targetLoc[2]) == true) then
		addConsoleMessage("It's just a tree.")
		return
	end

	addConsoleMessage("More snow. Snow everywhere.")

	return
end



function scannerCallback(targetLoc)
	
	if 	localTerrain[targetLoc[1]][targetLoc[2]].scanner == true then
		addConsoleMessage("There is already a scanner there!")
		return
	end

	addConsoleMessage("You throw your scanner module!","yellow")
	playerItems[usingItem] = deepcopy(gameItems.empty[1])

	localTerrain[targetLoc[1]][targetLoc[2]].scanner = true

	-- SO HORRIBLE
	if (localTerrain[targetLoc[1]+1]~= nil and localTerrain[targetLoc[1]+1][targetLoc[2]]~= nil) then localTerrain[targetLoc[1]+1][targetLoc[2]].scanned = true end
	if (localTerrain[targetLoc[1]+1]~= nil and localTerrain[targetLoc[1]+1][targetLoc[2]+1]~= nil) then localTerrain[targetLoc[1]+1][targetLoc[2]+1].scanned = true end
	if (localTerrain[targetLoc[1]+1]~= nil and localTerrain[targetLoc[1]+1][targetLoc[2]-1]~= nil) then localTerrain[targetLoc[1]+1][targetLoc[2]-1].scanned = true end

	if (localTerrain[targetLoc[1]-1]~= nil and localTerrain[targetLoc[1]-1][targetLoc[2]+1]~= nil) then localTerrain[targetLoc[1]-1][targetLoc[2]+1].scanned = true end
	if (localTerrain[targetLoc[1]-1]~= nil and localTerrain[targetLoc[1]-1][targetLoc[2]-1]~= nil) then localTerrain[targetLoc[1]-1][targetLoc[2]-1].scanned = true end
	if (localTerrain[targetLoc[1]-1]~= nil and localTerrain[targetLoc[1]-1][targetLoc[2]]~= nil) then localTerrain[targetLoc[1]-1][targetLoc[2]].scanned = true end

	if (localTerrain[targetLoc[1]]~= nil and localTerrain[targetLoc[1]][targetLoc[2]+1]~= nil) then localTerrain[targetLoc[1]][targetLoc[2]+1].scanned = true end
	if (localTerrain[targetLoc[1]]~= nil and localTerrain[targetLoc[1]][targetLoc[2]-1]~= nil) then localTerrain[targetLoc[1]][targetLoc[2]-1].scanned = true end

	gameTick()
end










